Optimal. Leaf size=195 \[ \frac {d^2 \left (12 c^2-16 c d+7 d^2\right ) x}{2 a^2}+\frac {2 d \left (c^3+8 c^2 d-20 c d^2+8 d^3\right ) \cos (e+f x)}{3 a^2 f}+\frac {d^2 \left (2 c^2+16 c d-21 d^2\right ) \cos (e+f x) \sin (e+f x)}{6 a^2 f}-\frac {(c-d) (c+8 d) \cos (e+f x) (c+d \sin (e+f x))^2}{3 a^2 f (1+\sin (e+f x))}-\frac {(c-d) \cos (e+f x) (c+d \sin (e+f x))^3}{3 f (a+a \sin (e+f x))^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.24, antiderivative size = 195, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 3, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.120, Rules used = {2844, 3056,
2813} \begin {gather*} \frac {d^2 \left (2 c^2+16 c d-21 d^2\right ) \sin (e+f x) \cos (e+f x)}{6 a^2 f}+\frac {d^2 x \left (12 c^2-16 c d+7 d^2\right )}{2 a^2}+\frac {2 d \left (c^3+8 c^2 d-20 c d^2+8 d^3\right ) \cos (e+f x)}{3 a^2 f}-\frac {(c-d) (c+8 d) \cos (e+f x) (c+d \sin (e+f x))^2}{3 a^2 f (\sin (e+f x)+1)}-\frac {(c-d) \cos (e+f x) (c+d \sin (e+f x))^3}{3 f (a \sin (e+f x)+a)^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2813
Rule 2844
Rule 3056
Rubi steps
\begin {align*} \int \frac {(c+d \sin (e+f x))^4}{(a+a \sin (e+f x))^2} \, dx &=-\frac {(c-d) \cos (e+f x) (c+d \sin (e+f x))^3}{3 f (a+a \sin (e+f x))^2}-\frac {\int \frac {(c+d \sin (e+f x))^2 \left (-a \left (c^2+5 c d-3 d^2\right )+a (2 c-5 d) d \sin (e+f x)\right )}{a+a \sin (e+f x)} \, dx}{3 a^2}\\ &=-\frac {(c-d) (c+8 d) \cos (e+f x) (c+d \sin (e+f x))^2}{3 a^2 f (1+\sin (e+f x))}-\frac {(c-d) \cos (e+f x) (c+d \sin (e+f x))^3}{3 f (a+a \sin (e+f x))^2}-\frac {\int (c+d \sin (e+f x)) \left (-a^2 (19 c-16 d) d^2+a^2 d \left (2 c^2+16 c d-21 d^2\right ) \sin (e+f x)\right ) \, dx}{3 a^4}\\ &=\frac {d^2 \left (12 c^2-16 c d+7 d^2\right ) x}{2 a^2}+\frac {2 d \left (c^3+8 c^2 d-20 c d^2+8 d^3\right ) \cos (e+f x)}{3 a^2 f}+\frac {d^2 \left (2 c^2+16 c d-21 d^2\right ) \cos (e+f x) \sin (e+f x)}{6 a^2 f}-\frac {(c-d) (c+8 d) \cos (e+f x) (c+d \sin (e+f x))^2}{3 a^2 f (1+\sin (e+f x))}-\frac {(c-d) \cos (e+f x) (c+d \sin (e+f x))^3}{3 f (a+a \sin (e+f x))^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.25, size = 378, normalized size = 1.94 \begin {gather*} \frac {\left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right ) \left (3 d \left (64 c^3+48 c^2 d (-4+3 e+3 f x)-32 c d^2 (-5+6 e+6 f x)+7 d^3 (-7+12 e+12 f x)\right ) \cos \left (\frac {1}{2} (e+f x)\right )-\left (16 c^4+128 c^3 d+48 c^2 d^2 (-10+3 e+3 f x)-16 c d^3 (-41+12 e+12 f x)+d^4 (-239+84 e+84 f x)\right ) \cos \left (\frac {3}{2} (e+f x)\right )+3 \left ((16 c-5 d) d^3 \cos \left (\frac {5}{2} (e+f x)\right )+d^4 \cos \left (\frac {7}{2} (e+f x)\right )+2 \left (8 c^4+32 c^3 d-144 c^2 d^2+144 c d^3-50 d^4+96 c^2 d^2 e-128 c d^3 e+56 d^4 e+96 c^2 d^2 f x-128 c d^3 f x+56 d^4 f x+d^2 \left (48 c^2 (e+f x)-64 c d (1+e+f x)+d^2 (27+28 e+28 f x)\right ) \cos (e+f x)-2 (8 c-3 d) d^3 \cos (2 (e+f x))+d^4 \cos (3 (e+f x))\right ) \sin \left (\frac {1}{2} (e+f x)\right )\right )\right )}{48 a^2 f (1+\sin (e+f x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.46, size = 250, normalized size = 1.28 Too large to display
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 986 vs.
\(2 (194) = 388\).
time = 0.53, size = 986, normalized size = 5.06 \begin {gather*} \frac {d^{4} {\left (\frac {\frac {75 \, \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {97 \, \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {126 \, \sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}} + \frac {98 \, \sin \left (f x + e\right )^{4}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{4}} + \frac {63 \, \sin \left (f x + e\right )^{5}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{5}} + \frac {21 \, \sin \left (f x + e\right )^{6}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{6}} + 32}{a^{2} + \frac {3 \, a^{2} \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {5 \, a^{2} \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {7 \, a^{2} \sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}} + \frac {7 \, a^{2} \sin \left (f x + e\right )^{4}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{4}} + \frac {5 \, a^{2} \sin \left (f x + e\right )^{5}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{5}} + \frac {3 \, a^{2} \sin \left (f x + e\right )^{6}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{6}} + \frac {a^{2} \sin \left (f x + e\right )^{7}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{7}}} + \frac {21 \, \arctan \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}\right )}{a^{2}}\right )} - 16 \, c d^{3} {\left (\frac {\frac {12 \, \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {11 \, \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {9 \, \sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}} + \frac {3 \, \sin \left (f x + e\right )^{4}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{4}} + 5}{a^{2} + \frac {3 \, a^{2} \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {4 \, a^{2} \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {4 \, a^{2} \sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}} + \frac {3 \, a^{2} \sin \left (f x + e\right )^{4}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{4}} + \frac {a^{2} \sin \left (f x + e\right )^{5}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{5}}} + \frac {3 \, \arctan \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}\right )}{a^{2}}\right )} + 12 \, c^{2} d^{2} {\left (\frac {\frac {9 \, \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {3 \, \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + 4}{a^{2} + \frac {3 \, a^{2} \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {3 \, a^{2} \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {a^{2} \sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}}} + \frac {3 \, \arctan \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}\right )}{a^{2}}\right )} - \frac {2 \, c^{4} {\left (\frac {3 \, \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {3 \, \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + 2\right )}}{a^{2} + \frac {3 \, a^{2} \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {3 \, a^{2} \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {a^{2} \sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}}} - \frac {8 \, c^{3} d {\left (\frac {3 \, \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + 1\right )}}{a^{2} + \frac {3 \, a^{2} \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {3 \, a^{2} \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {a^{2} \sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}}}}{3 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 452 vs.
\(2 (194) = 388\).
time = 0.38, size = 452, normalized size = 2.32 \begin {gather*} -\frac {3 \, d^{4} \cos \left (f x + e\right )^{4} - 2 \, c^{4} + 8 \, c^{3} d - 12 \, c^{2} d^{2} + 8 \, c d^{3} - 2 \, d^{4} + 6 \, {\left (4 \, c d^{3} - d^{4}\right )} \cos \left (f x + e\right )^{3} + 6 \, {\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} f x - {\left (2 \, c^{4} + 16 \, c^{3} d - 60 \, c^{2} d^{2} + 88 \, c d^{3} - 31 \, d^{4} + 3 \, {\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} f x\right )} \cos \left (f x + e\right )^{2} - {\left (4 \, c^{4} + 8 \, c^{3} d - 48 \, c^{2} d^{2} + 104 \, c d^{3} - 38 \, d^{4} - 3 \, {\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} f x\right )} \cos \left (f x + e\right ) + {\left (3 \, d^{4} \cos \left (f x + e\right )^{3} + 2 \, c^{4} - 8 \, c^{3} d + 12 \, c^{2} d^{2} - 8 \, c d^{3} + 2 \, d^{4} + 6 \, {\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} f x - 3 \, {\left (8 \, c d^{3} - 3 \, d^{4}\right )} \cos \left (f x + e\right )^{2} - {\left (2 \, c^{4} + 16 \, c^{3} d - 60 \, c^{2} d^{2} + 112 \, c d^{3} - 40 \, d^{4} - 3 \, {\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} f x\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{6 \, {\left (a^{2} f \cos \left (f x + e\right )^{2} - a^{2} f \cos \left (f x + e\right ) - 2 \, a^{2} f - {\left (a^{2} f \cos \left (f x + e\right ) + 2 \, a^{2} f\right )} \sin \left (f x + e\right )\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 8950 vs.
\(2 (185) = 370\).
time = 9.53, size = 8950, normalized size = 45.90 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.44, size = 338, normalized size = 1.73 \begin {gather*} \frac {\frac {3 \, {\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} {\left (f x + e\right )}}{a^{2}} + \frac {6 \, {\left (d^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 8 \, c d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 4 \, d^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - d^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 8 \, c d^{3} + 4 \, d^{4}\right )}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 1\right )}^{2} a^{2}} - \frac {4 \, {\left (3 \, c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 18 \, c^{2} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 24 \, c d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 9 \, d^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 3 \, c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 12 \, c^{3} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 54 \, c^{2} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 60 \, c d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 21 \, d^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 2 \, c^{4} + 4 \, c^{3} d - 24 \, c^{2} d^{2} + 28 \, c d^{3} - 10 \, d^{4}\right )}}{a^{2} {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}^{3}}}{6 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 9.21, size = 478, normalized size = 2.45 \begin {gather*} \frac {d^2\,\mathrm {atan}\left (\frac {d^2\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\left (12\,c^2-16\,c\,d+7\,d^2\right )}{12\,c^2\,d^2-16\,c\,d^3+7\,d^4}\right )\,\left (12\,c^2-16\,c\,d+7\,d^2\right )}{a^2\,f}-\frac {{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^5\,\left (2\,c^4+8\,c^3\,d-36\,c^2\,d^2+48\,c\,d^3-21\,d^4\right )+{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3\,\left (4\,c^4+16\,c^3\,d-72\,c^2\,d^2+112\,c\,d^3-42\,d^4\right )+{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4\,\left (\frac {16\,c^4}{3}+\frac {8\,c^3\,d}{3}-40\,c^2\,d^2+\frac {224\,c\,d^3}{3}-\frac {98\,d^4}{3}\right )+{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (\frac {14\,c^4}{3}+\frac {16\,c^3\,d}{3}-44\,c^2\,d^2+\frac {256\,c\,d^3}{3}-\frac {97\,d^4}{3}\right )+\frac {80\,c\,d^3}{3}+\frac {8\,c^3\,d}{3}+{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6\,\left (2\,c^4-12\,c^2\,d^2+16\,c\,d^3-7\,d^4\right )+\frac {4\,c^4}{3}-\frac {32\,d^4}{3}+\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\left (2\,c^4+8\,c^3\,d-36\,c^2\,d^2+64\,c\,d^3-25\,d^4\right )-16\,c^2\,d^2}{f\,\left (a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^7+3\,a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6+5\,a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^5+7\,a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4+7\,a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3+5\,a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2+3\,a^2\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )+a^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________